----------------------------------------------------------------------------------
-- Company: 
-- Engineer: 
-- 
-- Create Date: 2022/08/03 17:17:27
-- Design Name: 
-- Module Name: WHILEEXP - Behavioral
-- Project Name: 
-- Target Devices: 
-- Tool Versions: 
-- Description: 
-- 
-- Dependencies: 
-- 
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
-- 
----------------------------------------------------------------------------------
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

ENTITY WHILEEXP IS
  PORT (
    A : IN BIT_VECTOR (0 TO 3);
    Y : OUT BIT_VECTOR (0 TO 3));
END WHILEEXP;

ARCHITECTURE Behavioral OF WHILEEXP IS

BEGIN
  PROCESS (A) IS
    VARIABLE B : BIT;
    VARIABLE I : INTEGER RANGE 0 TO 3;
  BEGIN
    I := 0;
    WHILE I < 3 LOOP
      B := A(2 - I) AND B;
      Y(I) <= B;
      I := I + 1;
    END LOOP;
  END PROCESS;
END Behavioral;